package com.woniuxy.mytank.ui;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

import com.woniuxy.mytank.datacenter.DataCenter;
import com.woniuxy.mytank.util.ReadImage;

public class StartPanel extends JPanel implements Runnable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public StartPanel(){
		//this.setBounds(x, y, width, height);
		this.setSize(1116, 816);
		this.setLocation(0, 0);
		this.setBackground(Color.gray);
		this.setVisible(true);
		//new Thread(this).start();
	}
	
	int step=0;
	
	@Override
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		g.drawImage(ReadImage.startMenu[step], 0, 0, 1116,816,0,0,1641, 1200,this);
		//drawStart(g);
		
	}
	
	/*public void drawStart(Graphics g){
		DataCenter.sm.drawMenu(g, this);
	}*/
	
	@Override
	public void run() {
		while(!(DataCenter.isStart)){
			try {
				Thread.sleep(500);
				step+=1;
				if(step>1){
					step=0;
				}
				this.repaint();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		this.setVisible(false);
		
	}

}
